### Example configuration file for mlrpt
### desolve, 07.2020


## Maximum length of string parameters is limited to the 80 characters
## Missing or invalid mandatory settings are considered as erratic
## Missing or invalid optional settings will be set to default values


## Common options

# Satellite name. This will be shown in GUI and output logs
#
# Default value: empty string
# Type: string <optional>
# Valid values: any
sat_name = "Meteor-M2-2"

# Optional comment. If set, it will be included in output too
#
# Default value: empty string
# Type: string <optional>
# Valid values: any
comment = "IDOQPSK 80 kSym/s mode"


## SDR device settings

device: {
    # SoapySDR device driver name. You can find supported drivers by running:
    # SoapySDRUtil --info | grep "Available factories"
    # and picking the right one. Special value "auto" will select SDR receiver
    # that matches specified device index
    #
    # Default value: "auto"
    # Type: string <optional>
    # Valid values: any supported by SoapySDR
    driver = "auto"

    # SoapySDR device index
    #
    # Default value: 0
    # Type: uint <optional>
    # Valid values: 0 <= index <= 255
    index = 0
}


## SDR receiver settings

receiver: {
    # LRPT transmitter frequency (in kHz). From time to time Meteor satellites
    # change their transmitting frequency so adjust it accordingly
    #
    # Default value: none
    # Type: uint <mandatory>
    # Valid values: 136000 <= freq <= 138000
    freq = 137900

    # Low-pass filter bandwidth (in Hz). Maximum filter bandwidth should be
    # less than sampling rate used. Common usable range is 100-200 kHz with
    # optimum equals twice the symbol rate (about 140 kHz)
    #
    # Default value: 120000
    # Type: uint <optional>
    # Valid values: 90000 <= bw <= 210000
    bw = 120000

    # Gain value (in %). Actual value in dB depends on the device used.
    # Special value 0.0 enables Auto AGC mode while any other value up to 100.0
    # switches Manual AGC mode
    #
    # Default value: 0.0
    # Type: double <optional>
    # Valid values: 0.0 <= gain <= 100.0
    gain = 0.0

    # Frequency error correction factor (in ppm)
    #
    # Default value: 0.0
    # Type: double <optional>
    # Valid values: -100.0 <= corr_f <= 100.0
    corr_f = 0.0
}


## Demodulator settings

demodulator: {
    # Raised root cosine (RRC) filter order
    #
    # Default value: 32
    # Type: uint <optional>
    # Valid values: 0 <= rrc_order
    rrc_order = 32

    # RRC filter alpha factor
    #
    # Default value: 0.6
    # Type: double <optional>
    # Valid values: 0.0 <= rrc_alpha <= 1.0
    rrc_alpha = 0.6

    # Demodulator interpolation factor
    #
    # Default value: 4
    # Type: uint <optional>
    # Valid values: 0 <= interp_f
    interp_f = 4

    # Initial Costas PLL bandwidth (in Hz). Adjust this value to find best
    # compromise between early PLL lock and stray locks
    #
    # Default value: 100.0
    # Type: double <optional>
    # Valid values: 0.0 <= pll_bw
    pll_bw = 100.0

    # Costas PLL locking phase error threshold. Below this value PLL will be
    # considered as locked. Unlocked threshold is based upon this value and set
    # at 3% above it. Adjust this value accordingly with your antenna/receiver
    # setup so PLL unlocks just with signal loss
    #
    # Default value: 0.8
    # Type: double <optional>
    # Valid values: 0.0 <= pll_thresh
    pll_thresh = 0.8

    # QPSK modulation mode. This value depends on satellite working mode which
    # is subject to change sometimes so adjust it accordingly. Usually
    # Meteor-M2 works in plain QPSK and Meteor-M2-2 uses DOQPSK and IDOQPSK
    # modes
    #
    # Default value: none
    # Type: string <mandatory>
    # Valid values: "QPSK", "DOQPSK", "IDOQPSK"
    mode = "IDOQPSK"

    # Symbol rate of QPSK transmission (in Sym/s). This values depends on QPSK
    # modulation mode. Usual values are 72000 Sym/s for QPSK and DOQPSK modes
    # while IDOQPSK mode uses 80000 Sym/s
    #
    # Default value: none
    # Type: uint <mandatory>
    # Valid values: 50000 <= rate <= 100000
    rate = 80000
}


## Decoder settings

decoder: {
    # Active APIDs. These values are used while decoding soft-symbols from
    # demodulator. Meteor satellites change their operational mode sometimes
    # so be sure to set this parameter properly. The order of APID numbers
    # corresponds to mlrpt's internal channels 0, 1 and 2 which are used as
    # red, green and blue channels (don't mess it with Meteor's channels!)
    # Most common mode is [66, 65, 64] (RGB) but sometimes Meteor switches
    # to the IR mode [68, 65, 64]
    #
    # Default value: none
    # Type: array of uint <mandatory>
    # Valid values: [64-69, 64-69, 64-69]
    apids = [66, 65, 64]

    # Invertable APIDs. Normally used for inverting palette when Meteor
    # operates in IR mode. You should specify all three APID numbers in any
    # order but you can set any one of them to zero to disable palette
    # inverting for that APID
    #
    # Default value: [67, 68, 69]
    # Type: array of uint <optional>
    # Valid values: [0;64-69, 0;64-69, 0;64-69]
    apids_invert = [67, 68, 69]

    # mlrpt's channel numbers to be used while performing pseudo-colorization.
    # The sequence should match red, green and blue channels order. Most common
    # value is [0, 1, 2] however when Meteor operates in IR mode a value of
    # [1, 1, 2] could be used instead
    #
    # Default value: [0, 1, 2]
    # Type: array of uint <optional>
    # Valid values: [0-2, 0-2, 0-2]
    rgb_chans = [0, 1, 2]

    # Default duration of LRPT decoding (in s). Usually Meteor passes for
    # about 10-15 minutes but for longer flights you should use high-gain
    # directional antenna
    #
    # Default value: 900
    # Type: uint <optional>
    # Valid values: 0 <= duration <= 1200
    duration = 900
}


## Post-processing options

postproc: {
    # Pseudo-colorization. Performs some speculative colorization while
    # producing combo image
    #
    # Default value: true
    # Type: bool <optional>
    # Valid values: true/false
    colorize = true

    # Range of pixel values to use when performing pseudo-colorization. You can
    # adjust these values to get reasonable color balance while producing combo
    # image. Min value comes first followed by max value
    #
    # Default values:
    #                 [0, 240] for red channel
    #                 [0, 255] for green channel
    #                 [60, 255] for blue channel
    # Type: array of uint <optional>
    # Valid values: [0-255 (min), 0-255 (max)]; max >= min
    R_rng = [0, 240]
    G_rng = [0, 255]
    B_rng = [60, 255]

    # Blue channel pixel values range for fixing water areas colorization.
    # This option is useful if histogram equalization is enabled. This feature
    # has tendency to darken watery parts such as seas, lakes and rivers so
    # you can use option below to counteract this effect. Min value comes first
    # followed by max. Use only if you perform histogram equalization
    #
    # Default value: [60, 80]
    # Type: array of uint <optional>
    # Valid values: [0-255 (min), 0-255 (max)]; max >= min
    B_water_rng = [60, 80]

    # Blue channel pixel values threshold for cloudy areas colorization. If
    # pixel values of blue channel are higher than this setting these pixels
    # will be assumed as cloudy areas and all components of RGB will be set to
    # blue channel pixel value
    #
    # Default value: 210
    # Type: uint <optional>
    # Valid values: 0 <= B_clouds_thresh <= 255
    B_clouds_thresh = 210

    # Histogram equalization. Performs contrast stretching of the image
    #
    # Default value: true
    # Type: bool <optional>
    # Valid values: true/false
    normalize = true

    # Contrast Limited Adaptive Histogram Equalization (CLAHE). Enhances
    # regional contrast of images. Will have effect only if histogram
    # equalization is enabled
    #
    # Default value: true
    # Type: bool <optional>
    # Valid values: true/false
    clahe = true

    # Rectify images. Performs fixing of geometric distortion. Currently there
    # are two rectifying algorithms available: W2RG (Rich Griffits) and
    # 5B4AZ (Neoklis Kyriazis). The first one just fills spaces with pixels of
    # the same value while the second does some interpolation
    #
    # Default value: "5B4AZ"
    # Type: string <optional>
    # Valid values: "no", "W2RG", "5B4AZ"
    rectify = "5B4AZ"
}


## Output settings

output: {
    # Output type. You can save combined pseudo-colorized image, individual
    # channels or both
    #
    # Default value: "all"
    # Type: string <optional>
    # Valid values: "combo", "chan", "all"
    type = "all"

    # File type to save images. You can save pseudo-colorized combo image and
    # per-channel images in JPEG, PGM or both formats
    #
    # Default value: "JPEG"
    # Type: string <optional>
    # Valid values: "JPEG", "PGM", "all"
    format = "JPEG"

    # JPEG compression quality (in %)
    #
    # Default value: 100
    # Type: uint <optional>
    # Valid values: 0 <= jpeg_qual <= 100
    jpeg_qual = 100

    # Whether to save raw (unprocessed) images
    #
    # Default value: false
    # Type: bool <optional>
    # Valid values: true/false
    save_raw = false
}
